import Vue from 'vue'
import SampleMessageBoxPlugin from '../components/plugins/SampleMessageBox'
var vm = null
var LuiSampleMessageBox = {}
LuiSampleMessageBox.install = function(Vue, options) {
  // Vue.component('lui-sample-message-box', SampleMessageBoxPlugin)
  // 4. 添加实例方法
  Vue.prototype.$msgBox = function(messages) {
    let _opt = {
      title: '信息',
      body: messages
    }

    if (!vm) {
      let LuiSampleMessageBoxTpl = Vue.extend(SampleMessageBoxPlugin)
      vm = new LuiSampleMessageBoxTpl(options)
      var tpl = vm.$mount().$el
      document.body.appendChild(tpl)
    }
    return vm.show(_opt)
  }
}
export default LuiSampleMessageBox
